import request from '@/request/index.js'

const auth = 'auth' //http://101.42.107.47:30019文档
const base = 'base' //http://101.42.107.47:30020文档

//普通登录:根据用户名和密码进行登录
export const login = async(data) => {
        return request({
            url: `/api/${auth}/jwt/token`,
            method: 'post',
            data,
        })
    }
    //强制登录:根据用户名和密码进行登录
export const forceLogin = async(data) => {
        return request({
            url: `/api/${auth}/jwt/enforce`,
            method: 'post',
            data,
        })
    }
    //根据token获取菜单
export const getMenuList = async() => {
    return request({
        url: `/api/${base}/api/role`,
        method: 'get',
    })
}

//获取用户详情
export const getUserInfo = async() => {
    return request({
        url: `/api/${base}/api/user/hide`,
        method: 'get',
    })
}

//退出登录
export const logOut = async(data) => {
    return request({
        url: `/api/${auth}/jwt/loginOut`,
        method: 'POST',
        data,
    })
}